package com.soft.javase.day06.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/24
 */
public class RegexMatchText {
    public static void main(String[] args) {
        String text = "你好，若有问题请及时电话联系0510-1231231或者05101112223，也可以发送邮件至123@qq.com。\n" +
                "若遇紧急问题，可拨打13911112222，或者18523234646。欢迎致电800-820-8820，8008208820。" ;
        String regex = "(\\d{4}-\\d{7})|(\\d{10,11})|(\\d+@[A-Za-z0-9]+\\.[A-Za-z]+)|(\\d{3}-\\d{3}-\\d{4})";

        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(text);

        System.out.println("找到的联系方式:");
        while (matcher.find()) {
            System.out.println(matcher.group());
        }
    }
}
